class zuiduoshui:
    def __init__(self,a):
        self.a=a;
    def solution(self):
        num=[];
        num2=[];
        for i in self.a.split(","):
            num.append(int(i))
        for i in range(0,len(num)):
            for j in range(0,len(num)):
                if(i==j):
                    continue;
                else:
                    v=min(num[i],num[j])*abs(i-j);
                    num2.append(v);
        print(max(num2));

if __name__ == '__main__':
    a=input("请输入一串数据");
    b=zuiduoshui(a);
    b.solution();


